package uestc.lj.gulishop.ware.service;

import com.baomidou.mybatisplus.extension.service.IService;
import uestc.lj.common.to.OrderEntityTO;
import uestc.lj.common.to.StockLockedTO;
import uestc.lj.common.utils.PageUtils;
import uestc.lj.gulishop.ware.entity.WareSkuEntity;
import uestc.lj.gulishop.ware.vo.SkuHasStockVO;
import uestc.lj.gulishop.ware.vo.WareSkuLockVO;

import java.util.List;
import java.util.Map;

/**
 * 商品库存
 *
 * @author crazlee
 * @email peterlee0@163.com
 * @date 2021-05-21 19:33:02
 */
public interface WareSkuService extends IService<WareSkuEntity> {

    PageUtils queryPage(Map<String, Object> params);

    void addStock(Long skuId, Long wareId, Integer skuNum);

    List<SkuHasStockVO> getSkuHasStock(List<Long> skuIds);

    /**
     * 为订单锁库存
     *
     * @param skuLockVO
     * @return
     */
    Boolean lockStocks(WareSkuLockVO skuLockVO);

    void unLockStock(StockLockedTO to);

    void unLockStock(OrderEntityTO orderEntityTO);
}

